from PyQt4 import QtCore, QtGui

class PhotoSize():
    def __init__(self,  w,  h):
        self.w = w
        self.h = h

    def width(self):
        return self.w
        
    def height(self):
        return self.h
        
    def setWidth(self,  w):
        self.w = w
    
    def setHeight(self,  h):
        self.h = h

class PhotoConfig():
    def __init__(self):
        self.FORMAT_SOFT = 1
        self.FORMAT_HARD = 2
        self.UNIT_PIX = 100
        self.UNIT_INCH = 101
        self.UNIT_CM = 102
        self.name = "Passport"
        self.unit = self.UNIT_PIX
        self.format = self.FORMAT_SOFT
        self.dpi = 300
        self.size = PhotoSize(400,  514)
        self.h2c_min = 286
        self.h2c_max = 400
        
    def SetName(self,  name):
        self.name = name
        
    def SetUnit(self,  unit):
        if unit.lower() == "pix":
            self.unit = self.UNIT_PIX
        elif unit.lower() == "cm":
            self.unit = self.UNIT_CM
        elif unit.lower() == "inch":
            self.unit = self.UNIT_INCH
        
    def SetDpi(self,  dpi):
        self.dpi = dpi
        
    def SetFormat(self,  format):
        if format.lower() == "soft":
            self.format = self.FORMAT_SOFT
        elif format.lower() == "hard":
            self.format = self.FORMAT_HARD
            
    def SetSize(self,  size):
        self.size = size
        
    def SetSize(self,  width,  height):
        self.size = PhotoSize(width,  height)

    def SetWidth(self,  width):
        self.size.setWidth(width)
        
    def SetHeight(self,  height):
        self.size.setHeight(height)
        
    def SetH2C(self,  min,  max):
        self.h2c_min = min
        self.h2c_max = max
        
    def SetH2CMin(self,  min):
        self.h2c_min = min
        
    def SetH2CMax(self,  max):
        self.h2c_max = max
